import http from "@/utils/request";

export default {
  /**
   * 查询部门列表
   * @Param params
   * @return
   */
  async getDepartmentList(params) {
    return http.get("/api/department/list", params);
  },
  /**
   * 获取部门树列表
   * @return
   */
  async getParentTreeList() {
    return http.get("/api/department/parent/list");
  },
  /**
   * 新增部门
   * @param params
   * @return {Promise<返回值>}
   */
  async addDept(params) {
    return http.post("/api/department/add", params);
  },
  /**
   * 修改部门
   * @param params
   * @return {Promise<返回值>}
   */
  async updateDept(params) {
    return http.put("/api/department/update", params);
  },
  /**
   * 检查部门下是否有子部门
   * @param param
   * @return {AxiosPromise<any>}
   */
  async checkDepartment(param) {
    return http.getRestApi("/api/department/check", param);
  },
  /**
   * 删除部门
   * @param params
   * @return {AxiosPromise<any>}
   */
  async deleteDept(params) {
    return http.delete("/api/department/delete", params);
  }
}
